package org.crspta.gohomenotes.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ManyToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord(finders = { "findAppRolesByNameLike", "findAppRolesByNameEquals" })
public class AppRole {

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<AppUser> users = new HashSet<AppUser>();

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<AppRight> rights = new HashSet<AppRight>();

    @NotNull
    @Size(min = 3, max = 30)
    private String name;

    private String description;
}
